#pragma once
#include "RBTree_Set_Map.h"
namespace bit
{
	template<class K>
	class set
	{
		struct Oft
		{
			const K& operator()(const K& data)
			{
				return data;
			}
		};
	public:
		typedef typename RBTreeNode<const K> Node;
		typedef typename RBTree<K, const K, Oft>::iterator iterator;
		typedef typename RBTree<K, const K, Oft>::const_iterator const_iterator;
		
		iterator begin()
		{
			return _s.begin();
		}
		iterator end()
		{
			return _s.end();
		}
		const_iterator begin() const
		{
			return _s.begin();
		}
		const_iterator end() const
		{
			return _s.end();
		}

		iterator find(const K& k)
		{
			return _s.Find(k);
		}

		pair<iterator, bool> insert(const K& data)
		{
			return _s.Insert(data);
		}
	private:
		RBTree<K, const K, Oft> _s;
	};
	void SetTest()
	{
		set<int> s;
		int a[] = { 4, 2, 6, 1, 3, 5, 15, 7, 16, 14 };
		for (auto e : a)
		{
			s.insert(e);
		}
		
		set<int>::iterator it = s.begin();
		while (it != s.end())
		{
			cout << *it << endl;
			++it;
		}
		cout << endl;

		it = s.find(7);
		cout << *it << endl;
	}
}